﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NHibernate;
using ZLCMS.Data.Model;

namespace ZLCMS.Web.SystemManage.Template
{
    public partial class SetPageDialog : System.Web.UI.Page
    {
        protected int SelectedId { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SelectedId = Int32.Parse(Request["pid"]);
            }
            catch
            {
            	
            }
            using (ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
            {
                string sql = "from CmsPageInfo where 1=1 ";

                IQuery  query = session.CreateQuery(sql + "order by Sort");

                IList<CmsPageInfo> list = query.List<CmsPageInfo>();
                repeater1.DataSource = list;
                if (SelectedId == 0)
                {
                    SelectedId = list[0].Id;
                }
            }
            repeater1.DataBind();

        }
    }
}